<?php
namespace Admin\Controller;

class AttrController extends BaseController{
    function index(){
        if(IS_AJAX){
            $data=M('attr')->select();
            $this->ajaxReturn($data);
            die;
        }
        $this->display();
        
    }
    
    function add(){
        
        if(IS_POST){
            $_POST['isselect']=0;
            if(!empty(I('post.options')))
                $_POST['isselect']=1;
            
            //dump(I('post.'));die;
            M('attr')->add(I('post.'));
            $this->redirect('index');
            
        }
        $category=M('category')->select();
        $this->assign('category',$category);
        $this->display();
    }
}